package com.zzq.my.jetpacks.jectpackapp.ui.act

import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import androidx.appcompat.widget.AppCompatImageView
import by.kirich1409.viewbindingdelegate.viewBinding
import com.aisier.architecture.base.BaseActivity
import com.google.android.flexbox.FlexboxLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.jennifer.andy.androidxlazyload.demo.adapter.FragmentLazyStateAdapter
import com.zzq.my.jetpacks.jectpackapp.*
import com.zzq.my.jetpacks.jectpackapp.bean.StepItemInfo
import com.zzq.my.jetpacks.jectpackapp.databinding.*

/**
 * 描述：ViewPager2 本身就支持对实际可见的 Fragment 才调用 onResume 方法
 * 作者：zhuangzeqin
 * 时间: 2022/1/18-17:04
 * 邮箱：zzq@eeepay.cn
 * 备注:
 */
class Activity9 : BaseActivity(R.layout.activity_8),View.OnClickListener{
    private val binding by viewBinding(Activity8Binding::bind)
    /**
     * 初始化数据
     */
    override fun initData() {
      val list =   mutableListOf<StepItemInfo>()
        list.add(StepItemInfo("商户信息","1"))
        list.add(StepItemInfo("结算信息","2"))
        list.add(StepItemInfo("店铺信息","3"))
//        list.add(StepItemInfo("签名信息","4"))
//        list.add(StepItemInfo("认证信息","5"))
        binding.flexboxLayoutRoot.parent
        list.forEachIndexed { index, stepItemInfo ->
            val stepView= layoutInflater.inflate(R.layout.item_step_view,null)
            val stepLine= layoutInflater.inflate(R.layout.item_step_line,null)
//            val icon_step =  stepView.findViewById<AppCompatImageView>(R.id.icon_step)
//            val params =  FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.MATCH_PARENT,FlexboxLayout.LayoutParams.WRAP_CONTENT)
//            params.leftMargin= 15
//            params.rightMargin=15
            binding.flexboxLayoutRoot.addView(stepView)
//            val params2 =  FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.MATCH_PARENT,1)
            if(index!=list.size-1)
            binding.flexboxLayoutRoot.addView(stepLine)
        }
//        LayoutInflater.from(this)

//        val viewPager2 = binding.viewPager2.apply {
//            adapter = FragmentLazyStateAdapter(this@Activity8, generateTextFragments(4))
//        }
//        TabLayoutMediator(binding.tabLayout, viewPager2) { tab, position ->
//            tab.text = "Fragment ${position + 1}"
//        }.attach()
    }

    /**
     * 初始化操作
     */
    override fun initView() {

    }

    /**
     * 初始化点击事件操作
     */
    override fun eventOnClick() {

    }

    override fun onClick(v: View) {

    }

}